#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);

    int q = -1, k = 0, l = 1, maxl = 0;
    for (int i = 0; i < n; ++i)
    {
        k = q;
        scanf("%d", &q);
        if (q == k + 1)
        {
            ++l;
        }
        else
        {
            if (maxl < l)
            {
                maxl = l;
            }
            l = 1;
        }
    }

    printf("%d", maxl);
    return 0;
}